#include "Box.h"
#include "Const.h"
#include "GameUtils.h"
#include "Level.h"
#include "string.h"

Box::Box(const char* name)
{
	strcpy(this->name, name);
}
void Box::LoadBoxes(vector<Box*> *boxes)
{
	vector<char*> lines;
	ReadTxtToLine(ROOT_LEVEL_DIR"Islands.txt", &lines);

	for(int i = 0; i < lines.size(); i++)
	{
		char* line = lines[i];
		if(strcmp(line, "[Island]") == 0)
		{
			i++;
			line = lines[i];
			Box* box = new Box(line);
			box->LoadLevel();
			boxes->push_back(box);
		}
	}
}

void Box::LoadLevel()
{
	Level::LoadLevelData(&levels, name);
}

Level* Box::GetLevel(int index)
{
	return levels[index];
}